#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<time.h>
int lt2_4(){
	const int MOD = 1000000;
	int mid = 1;
	int res = 0;
	int n = 0;
	scanf("%d",&n);
	double tstart = clock();

	for (int i = 1; i <= n; i++){
		mid = mid*i % MOD;
		if (mid == 0){
			//printf("mid0:%d\n",i-1);
			break;
		}
		res += mid;
	}
	double tend = clock();
	printf("%d\n",res%MOD);
	printf("Time used:%.2f",(double)(tend-tstart)/CLOCKS_PER_SEC);

	return 0;
}